//公共请求方法
import base from './base'
import axios from '@/utils/request'

const api = {
    /*
     首页数据统计
     */
    totalInfo() {
        return axios.get(base.totalInfo)
    },
    //首页订单数据
    orderInfo() {
        return axios.get(base.orderInfo)
    },
    //首页图表数据
    format() {
        return axios.get(base.format)
    },
    //产品列表 page
    projectList(params) {
        return axios.get(base.projectList, { params })
    },

    //搜索接口
    search(params) {
        return axios.get(base.search, { params })
    },

    //根据id删除商品
    deleteItemById(params) {
        return axios.get(base.deleteItemById, { params })
    },

    //商品类目 params={type:cid}
    selectItemCategoryByParentId(params) {
        return axios.get(base.selectItemCategoryByParentId, { params })
    },

    //添加商品
    //title, image, sellPoint, price, cid, category, num, descs, paramsInfo
    insertTbItem(params) {
        return axios.get(base.insertTbItem, { params })
    },

    //批量删除{ids:字符串}
    batchDelete(params) {
        return axios.get(base.batchDelete, { params })
    },

    //商品修改
    //id,title, image, sellPoint, price, cid, category, num, descs, paramsInfo
    updateTbItem(params) {
        return axios.get(base.updateTbItem, { params })
    },

    //获取分类
    itemCategory() {
        return axios.get(base.itemCategory);
    },

    //增加一级导航  name
    insertCategory(params) {
        return axios.get(base.insertCategory, { params })
    },
    //增加子导航 params={cid  name}
    insertItemCategory(params) {
        return axios.get(base.insertItemCategory, { params })
    },
    //删除分类 id
    deleteContentCategoryById(params) {
        return axios.get(base.deleteContentCategoryById, { params })
    },
    //修改分类 id name
    updateCategory(params) {
        return axios.get(base.updateCategory, { params })
    },

    //查询订单 page
    orderList(params){
        return axios.get(base.orderList,{params})
    },

    changeStatus(params){
        return axios.get(base.changeStatus,{params})
    },

    //汇总清单 page
    collect(params){
        return axios.get(base.collect,{params})
    },

    //撤销汇总 id
    cancel(params){
        return axios.get(base.cancel,{params})
    },

    //订单详情 id
    getDetail(params){
        return axios.get(base.detail,{params})
    },

    //登录
    //{
    // user,
    // pwd
    //}
    login(params){
        return axios.post(base.login,params)
    },

    //权限
    //params={token:''}
    permission(params){
        return axios.get(base.permission,{
            params
        })
    }

}

//单独导出permission 方法 给store中menu.js使用
export function permission(params){
    return axios.get(base.permission,{
        params
    })
}
export default api